{% extends 'base_account.html' %}

{% load account %}
{% load i18n %}

{% block head_title %}Sign In{% endblock head_title %}
{% block page_title %}Sign In{% endblock page_title %}
{% block extra_head %}
    <script>
        $(document).ready(function() {
            if (!("autofocus" in document.createElement("input"))) {
                $("#id_login").focus();
            }
        });
    </script>
{% endblock %}
{% block content %}
<div class="row">
    <div class="col-md-6">
        {% if socialaccount.providers  %}
            <p>
                {% blocktrans with site.name as site_name %}Please sign in with one
                of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
                for a {{site_name}} account and sign in below:
                {% endblocktrans %}
            </p>
            <div class="socialaccount_ballot">
                <ul class="socialaccount_providers">
                    {% include "socialaccount/snippets/provider_list.html" %}
                </ul>
                <div class="login-or">{% trans 'or' %}</div>
            </div>
            {% include "socialaccount/snippets/login_extra.html" %}
        {% endif %}
        <form class="login" method="POST" action="{% url 'account_login' %}">
            {% csrf_token %}
            {% if form.errors %}
                <div class="alert alert-error">
                    {% for field, msg in form.errors.items %}
                        {% if field != "__all__" %}<b>{{ field }}</b>{% endif %}
                        {{ msg }}
                    {% endfor %}
                </div>
            {% endif %}

            <div class="form-group">
                <label for="id_login">Login:</label>
                <input id="id_login" class="form-control" name="login" placeholder="Username or e-mail" type="text" autofocus>
            </div>
            <div class="form-group">
                <label for="id_password">Password:</label>
                <input id="id_password" class="form-control" name="password" placeholder="Password" type="password">
            </div>
            <div class="checkbox">
                <label for="id_remember">
                    <input id="id_remember" name="remember" type="checkbox">
                    Remember Me
                </label>
            </div>
            {% if redirect_field_value %}
              <input type="hidden" name="{{ redirect_field_name }}" value=  "{{ redirect_field_value }}" />
            {% endif %}
            <button class="btn btn-primary margin-top" type="submit">{% trans "Sign In" %}</button>
        </form>
        <p>
        <p><a href="{% url 'account_signup' %}">Don't have an account? Sign up!</a></p>
        <p><a href="../password/reset/">Forgot your password?</a></p>
        <a href="" onclick="alert('Please wait 5 minutes and attempt logging in again to resend confirmation email.'); return false;">Resend confirmation email</a>
    </div>
</div>
{% endblock %}
